home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
101-125
/
disk_110
/
pdc
/
readme
< prev
next >
Wrap
Text File
|
1992-05-06
|
7KB
|
196 lines
PDC: A public Domain Optimizing C Compiler.
01 October 1987.
Original by Matthew Brandt.
Ported to the Amiga by Jeff Lydiatt. You can reach me at:
USENET: jlydiatt@jlami.vnet.van-bc.UUCP
or : {ihnp4!alberta!ubc-vision,uunet}!van-bc!jlami!jlydiatt
POSTAL:
Jeff Lydiatt
#46-11291-7th Avenue.
Richmond, B.C.
Canada.
V7E4J3.
SYNOPSIS
A freely distributable (for non-commercial purposes) optimizing C
compiler that generates metacomco-compatible assembler source code. This
is an instructional only version, but with a bit of work could be made
into a public domain working compiler for the Amiga. Please don't call
me and tell me it doesn't work. I know! I am releasing it in the hope
that someone else has the time to devote to it. If you do come up with
some improvements, I would like to get the source from you though.
INTRODUCTION
Here is a Public Domain optimizing C compiler that I downloaded from
the IBM sig on "The Source" last fall and have fixed up to generate
metacomco-compatible assember source code that can be run through a
public domain assembler (also supplied) and The Software Distilleries
Blink to produce an executable program. The source is obviously the same
as the one on Fish Disk #53, although there may have been a few minor
differences.
The compiler originally generated what I assume to be Unix-style
MC68000 assembler source code. I spend many evenings last fall
converting it to the default 16 bit integer Manx Aztec C, fixing a few
bugs and omissions, and getting it to assemble under the Metacomco
assembler. Then Charlie Gibbs came out with his PD assembler, and we
were both hoping that we would be able to have a compiler we could
release as for general distribution. Unfortunately, that was last
spring! We both seem to be busy on other projects, and the compiler has
not seen any progress since February.
I have therefore decided to release the code as is in the hope that
someone else will get enthused, as I did, and will put some more work
into it. I have gathered together the source, some test examples, a PD
make program and some source code for a C library. Please note that the
original source is copyrighted by Matthew Brandt but may be freely
distributed for non-commercial use.
COMPILER USEAGE
The syntax for invoking the compiler is
PDC [-n] [-l] SourceFileName
where
-n will bypass the optimization phase.
-l will give a listing of the source code in the
file named SourceFileName.lis.
By default, no listing is produced.
SourceFileName is the name of the source.
The compiler will output the generated assembler source
code in a file called SourceFileName.s.
COMPILER SPECIFICATIONS
This is a top down recursive descent compiler with a post-processing
peephole optimizer. PDC reads in C source code and outputs metacomco-
compatible assembler source code. PDC supports most of the standard C
statements including enum, but is deceidly limited in breadth of variable
types. Some of the limitations are:
o The compiler does not support floating point, although you may
declare them, but the code generator does not support them..
o The compiler has a very primitive preprocessor. There is a
very good one on Fish disk 28 that I hoped to interface as
a prior stage but didn't have time. What's C without a good
preprocessor?
o PDC treats all constants as 4 byte integers. This will cause
problems if you call a ROM routine such as printf with the
following:
printf( "Here is the character %c\n", 'x' );
The code fragment:
char x;
x = 'x';
printf( "Here is the character %c\n", x );
will work ok though. The lesson to be learned if you plan to
use PDC is to pass variables rather than constants for all
non-long integers.
o PDC also needs a library of all the standard library functions,
especially the I/O functions printf, getchar, putchar, gets, puts
etc.
o PDC does not support several C constructs. Multiple initializations
like "x=y=0;" are not supported.
KNOWN BUGS
PDC has a number of bugs that I am aware of. There are undoubtedly
a large number I haven't come across yet.
o Why is
char **argv;
handled ok for example, but
char *argv[];
is not?
o The optimizer isn't perfect. Have a look at the code generated
for the "default" statement in the example, "logic.c".
o Short and character constants are not handled properly.
The original read me file posted on the follows:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NOTICE:
68000 C compiler
Copyright 1984, 1985, 1986 Matthew Brandt.
all commercial rights reserved.
This compiler is intended as an instructive tool for personal use. Any
use for profit without the written consent of the author is prohibited.
This compiler may be distributed freely for non-commercial use as long
as this notice stays intact. Please forward any enhancements or questions
to:
Matthew Brandt
Box 920337
Norcross, Ga 30092
This compiler is an optimizing C compiler for the Motorola 68000 processor.
It has successfully compiled itself on UNIX system V running on a Motorola
VME-10. Since this code was written for a machine with long integers it may
exhibit some irregularity when dealing with long integers on the IBM-PC.
The author makes no guarantees. This is not meant as a serious developement
tool although it could, with little work, be made into one. The bugs and
limitations of this compiler are listed below:
-Although you may declare floating point types the code generator does
not know how to deal with them. They should therefore be avoided.
-The preprocessor does not support arguments to #define'd macros or
any of #line #ifdef... etc. Only #include and #define are supported.
-Function arguments declared as char may not work properly. Declare
them as int.
-The size of functions is slightly limited due to the fact that the
entire function is parsed before any code is generated.
-The output of the compiler is in the UNIX 68000 assembler format.
To run the compiler type "cc68 sieve.c". This will compile the program sieve
and produce two files; sieve.lis is a source listing with a symbol type
reference; sieve.s is the 68000 assembly language produced.
The file lib.s is the assembly source for some runtime support routines
which must be loaded with the final code. The is no standard runtime library
support.
The compiler can be compiled by microsoft C version 3.0 or higher. MSC will
issue lots of warnings but they can be ignored. The file make.bat will
rebuild the compiler if MSC is available.
If you wish to make commercial use of all or part of this package please
contact me at the above address or (404)662-0366. Any voluntary contribution
from non-commercial users will be greatly appreciated but is by no means
necessary. enjoy...
Matt Brandt